package com.chengyu.core.controller.callback.pay;

import com.chengyu.core.controller.callback.PayCallbackController;
import com.chengyu.core.controller.callback.manager.CallbackManager;
import com.chengyu.core.entity.CommonResult;
import com.chengyu.core.service.pay.PayService;
import com.chengyu.core.service.pay.TyPayService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Api(tags = "订单支付回调")
@Controller
public class OrderPayCallbackController extends PayCallbackController {


    @ApiOperation(value = "微信支付回调 /商城")
    @ResponseBody
    @RequestMapping(value = PayService.WXPAY_NOTIFY_URL_ORDER, method = RequestMethod.POST)
    public CommonResult<String> paySusForWx(HttpServletRequest request) throws Exception {
        return this.paySusForWx(request, CallbackManager.CALLBACK_ORDER);
    }
    @ApiOperation(value = "拖运微信支付回调 /运输")
    @ResponseBody
    @RequestMapping(value = PayService.TY_WXPAY_NOTIFY_URL_ORDER, method = RequestMethod.POST)
    public CommonResult<String> tyPaySusForWx(HttpServletRequest request) throws Exception {
        return this.paySusForWx(request, CallbackManager.TY_CALLBACK_ORDER);
    }

    @ApiOperation(value = "充值微信支付回调 /充值/打赏/保证金")
    @ResponseBody
    @RequestMapping(value=PayService.WXPAY_NOTIFY_URL_RECHARGE, method=RequestMethod.POST)
    public CommonResult<String> reChangePaySusForWx(HttpServletRequest request) throws Exception{
        return this.paySusForWx(request, CallbackManager.CALLBACK_RECHARGE);
    }







    @ApiOperation(value = "支付宝支付回调 /商城")
    @ResponseBody
    @RequestMapping(value = PayService.ALIPAY_NOTIFY_URL_ORDER, method = RequestMethod.POST)
    public CommonResult<String> paySusForZfb(HttpServletRequest request, HttpServletResponse response) throws Exception {
        return this.paySusForZfb(request, response, CallbackManager.CALLBACK_ORDER);
    }


    @ApiOperation(value = "拖运支付宝支付回调 /运输")
    @ResponseBody
    @RequestMapping(value = PayService.TY_ALIPAY_NOTIFY_URL_ORDER, method = RequestMethod.POST)
    public CommonResult<String> tyPaySusForZfb(HttpServletRequest request, HttpServletResponse response) throws Exception {
        return this.paySusForZfb(request, response, CallbackManager.TY_CALLBACK_ORDER);
    }

    @ApiOperation(value = "充值支付宝支付回调 /充值/打赏/保证金")
    @ResponseBody
    @RequestMapping(value= PayService.ALIPAY_NOTIFY_URL_RECHARGE, method=RequestMethod.POST)
    public CommonResult<String> reChangePaySusForZfb(HttpServletRequest request, HttpServletResponse response) throws Exception{
        return this.paySusForZfb(request, response, CallbackManager.CALLBACK_RECHARGE);
    }




}
